<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list"
    style="padding: 20px 30px 0 0;">


    <div class='layui-form-item'>
        <div class="layui-form-mid layui-word-aux">
            导入之前请先下载导入模板，避免文件格式或内容错误
            <button type="button" class="layui-btn layui-btn-xs" onclick="loadtem()">下载模板</button>
            <br />
            <!--<div style="color:green">
                注：<br />&nbsp;&nbsp;&nbsp;
                1.文档中带有<span style="color:red">*</span>的字段为必填字段。<br />&nbsp;&nbsp;&nbsp;
                2.使用单位填写需要对应系统内已有的单位名称。
            </div>-->
        </div>
    </div>

    <button type="button" class="layui-btn" id="test1">
        <i class="layui-icon">&#xe67c;</i>上传文件
    </button>

    <div>
        <p><br></p>
        <p>
            1. 请先下载模板 2.填写数据进行上传
    </div>

    <div style="color:red">
        <div id="res"></div>
    </div>
</div>

<script type="text/javascript">


    function loadtem() {
        window.open("/Admin/src/memberW.xls")
    }

    var lindex = "";
    layui.use(['form', 'admin', 'table'], function () {
        var $ = layui.$
        , admin = layui.admin
        , view = layui.view
        , form = layui.form;
        var upload = layui.upload;
        var table = layui.table;

        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            , url: '/Shop/Member_whitelistMgr/importData' //上传接口
            , accept: 'file'
            , exts: "xlsx|xls"
            , data: { access_token: layui.data(layui.setter.tableName)[layui.setter.request.tokenName] }
            , before: function (res) {
                lindex = layer.load(1);
                layer.load(); //上传loading
                //上传完毕回调
            }
            , done: function (res) {
                // layer.closeAll('loading'); //关闭loading
                // if (res.ResultCode == 1) {
                //     alert(res.ResultInfo);
                //     return;
                // }

                // layer.msg('上传成功！');
                // //上传完毕回调
                // layer.closeAll('page');
                // location.reload();
                debugger
                layer.closeAll('loading'); //关闭loading
                layer.close(lindex);
                if (res.ResultCode == 0) {
                    $("#res").html(res.ResultInfo);
                    table.reload('LAY-app-content-list');
                } else {
                    $("#res").html(res.ResultInfo);
                }
            }
            , error: function (res) {
                layer.closeAll('loading'); //关闭loading
                //请求异常回调
            }
        });
    });
</script>